package com.nulldev.util.security.hashAPI.impls.keccak.impl;

public class SHA3 extends Keccak {
	public SHA3(int digestSizeBits) {
		super(digestSizeBits);
	}

	public SHA3(SHA3 other) {
		super(other);
	}

	@Override
	public String toString() {
		return "SHA3-" + digestSizeBits;
	}

	@Override
	protected void pad() {
		updateBits(0x02, 2);
		super.pad();
	}

	@Override
	protected void squeeze() {
		throw new UnsupportedOperationException("SHA-3 cannot be squeezed");
	}

	@Override
	protected int rateSizeBitsFor(int digestSizeBits) {
		switch (digestSizeBits) {
			case 224:
				return 1152;
			case 256:
				return 1088;
			case 384:
				return 832;
			case 512:
				return 576;
			default:
				throw new IllegalArgumentException("Invalid digestSizeBits: " + digestSizeBits + " E { 224, 256, 384, 512 }");
		}
	}
}